<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<div>
    <!--true代表登录过 不显示  false未登录 显示  !isLogin:状态false 表示未登录 -->
  <div v-if="!isLogin">
      <a href="javascript:void(0)">注册</a>
      <!--如果超链接点击时 不离开此页面需要添加javascript:void(0) 废掉跳转功能-->
      <a href="javascript:void(0)" @click="isLogin=true">登录</a>
  </div>
    <div v-else>
        <input type="text" v-model="name">
        <input type="button" value="添加"  @click="arr.push(name)">
        <a href="javascript:void(0)" @click="isLogin=false">退出</a>
    </div>
    <ul>
        <li v-for="n in arr">{{n}}</li>
    </ul>
</div>
<script src="../js/vue.js"></script>
<script>
    let v = new Vue({
        el:"body>div",
        data:{
            arr:["刘备","关羽"],
            isLogin:false
        }
    })
</script>
</body>
</html>